<?php
namespace Api\Controller;
use Think\Controller;
class AuthController extends CommonController {
    public function check(){
		$Auth = $this->isAuth();
		if($Auth == true)
		{
			$User = M ('User');
			$ret = $User->where("user_id='{$_SESSION['user_id']}'")->find();
			//echo $User->getLastsql();
			if($ret['mobile_no'] == '0'){
				$this->response(false,3,"未绑定手机号码",true);			
			}
			$data = array(
				'user_id' => $_SESSION['user_id'],
				'user_nickname' => $_SESSION['user_nickname'],
				'head_img' => $_SESSION['head_img'],
			);
			$this->response(true,1,$data,true);
		}else{
			$this->response(false,0,"未授权登录",true);
		}
	}
	public function loginout(){
		unset($_SESSION['user_id']);
		unset($_SESSION['user_nickname']);
		unset($_SESSION['head_img']);
		$this->response(true,0,null,true);
	}
}
